package com.squirrel.common.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.squirrel.common.entity.UserVideo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * UserVideoMapper 用户视频接口
 * </p>
 *
 * @author 关远键
 * @since 2021/11/11 16:06
 */
@Repository
public interface UserVideoMapper extends BaseMapper<UserVideo> {

    // 根据视频ID获取：喜欢数、收藏数、点赞数
    Integer enjoyByVideoId(@Param("videoId") Integer videoId);

    Integer collectByVideoId(@Param("videoId") Integer videoId);

    Integer likeByVideoId(@Param("videoId") Integer videoId);

    Float scoreByVideoId(@Param("videoId") Integer videoId);

    // 根据用户ID获取：喜欢数、收藏数、点赞数
    IPage<UserVideo> getByUserId(Page<UserVideo> userVideoPage, @Param("userId") Integer userId);

    IPage<UserVideo> getCollectByUserId(Page<UserVideo> userVideoPage, @Param("userId") Integer userId);

    Integer enjoyByUserId(@Param("userId") Integer userId);

    Integer collectByUserId(@Param("userId") Integer userId);

    Integer likeByUserId(@Param("userId") Integer userId);

    List<UserVideo> getHistoryByUserId(@Param("userId") Integer userId);

    UserVideo get(@Param("videoId") Integer videoId, @Param("userId") Integer userId);

}
